<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>外链分类管理</title>
    <!--标题栏图标-->
    <link rel="icon" href="../../static/images/Common/favicon.ico" th:href="@{/images/Common/favicon.ico}"
          type="images/x-ico"/>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="../../static/css/me-common.css" th:href="@{/css/me-common.css}">
    <link rel="stylesheet" href="../../static/css/me-special.css" th:href="@{/css/me-special.css}">
    <link rel="stylesheet" href="../../static/css/me-media.css" th:href="@{/css/me-media.css}">
</head>
<body>

<!------导航------>
<!--inverted:颜色反转；attached消除圆角-->
<nav th:replace="admin/_fragments :: menu(5)" class="ui inverted attached segment m-padded-tb-mini">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <img src="../../static/images/Common/logo_row_simple.png" th:src="@{/images/Common/logo_row_simple.png}"
                 class="left float image m-margin-right-middle" height="50px" alt="">
            <a href="../index.html" class="m-item item m-mobile-hide"><i class="home icon m-margin-right-no"></i>首页</a>
            <a href="../categories.html" class="m-item item m-mobile-hide"><i
                    class="folder open icon m-margin-right-no"></i>分类</a>
            <a href="../tags.html" class="m-item item m-mobile-hide"><i class="tags icon m-margin-right-no"></i>标签</a>
            <a href="../archives.html" class="m-item item m-mobile-hide"><i class="archive icon m-margin-right-no"></i>归档</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="heartbeat icon m-margin-right-no"></i>娱乐<i
                    class="angle down icon m-margin-right-no "></i></a>
            <a href="../links.html" class="m-item item m-mobile-hide"><i
                    class="linkify icon m-margin-right-no"></i>外链</a>
            <a href="../about.html" class="m-item item m-mobile-hide"><i class="user icon m-margin-right-no"></i>关于我</a>
            <div class="right m-item m-mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img src="../../static/images/Common/avatar.png" alt="" class="ui avatar image">
                        Phoenix
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">退出登录</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui black menu toggle icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
</nav>

<!--二级导航-->
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="#" th:href="@{/admin/linkCategories/newLinkCategory}" class="item">新增</a>
            <a href="#" th:href="@{/admin/linkCategories}" class="teal item active">列表</a>
        </div>
    </div>
</div>


<!------中间内容------->
<main class="m-container-small">
    <div class="ui container">
        <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
            <i class="close icon"></i>
            <div class="header">提示：</div>
            <p th:text="${message}">恭喜，操作成功！</p>
        </div>

        <table class="ui celled table celled teal hover-shadow-light">
            <thead>
            <tr>
                <th>序号</th>
                <th>分类名称</th>
                <th>优先级</th>
                <th>执行操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="linkCategory,iterStata : ${page.content}">
                <td th:text="${iterStata.count}">1</td>
                <td th:text="${linkCategory.name}">认知升级</td>
                <td th:text="${linkCategory.priority}">1</td>
                <td>
                    <a href="#" th:href="@{/admin/linkCategories/{id}/edit(id=${linkCategory.id})}" class="ui mini teal button">编辑</a>
                    <button class="ui mini red button" th:onclick="showDeleteDialog('linkCategories',[[${linkCategory.id}]],[[${linkCategory.name}]])">删除</button>
                </td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <th colspan="6">
                    <a href="" th:href="@{/admin/linkCategories/newLinkCategory}" class="ui teal basic button">新增分类</a>
                    <div class="ui right floated pagination menu" th:if="${page.totalPages}>1">
                        <a class="icon item" th:href="@{/admin/linkCategories(page=${page.number}-1)}"
                           th:unless="${page.first}">
                            <i class="left chevron icon"></i>
                        </a>
                        <!--                        <a class="item">1</a>-->
                        <!--                        <a class="item">2</a>-->
                        <!--                        <a class="item">3</a>-->
                        <!--                        <a class="item">4</a>-->
                        <a class="icon item" th:href="@{/admin/linkCategories(page=${page.number}+1)}"
                           th:unless="${page.last}">
                            <i class="right chevron icon"></i>
                        </a>
                    </div>
                </th>
            </tr>
            </tfoot>
        </table>
    </div>
</main>

<th:block th:replace="admin/_fragments :: deleteDialog('外链分类')">
    <div class="ui mini delete modal">
        <div class="header">删除外链分类</div>
        <div class="content">
            <p>你确定删外链分类“<span id="delete-name"></span>”吗，删除后无法恢复！</p>
        </div>
        <div class="actions">
            <div class="ui negative button">取消</div>
            <div class="ui positive right labeled icon button"><font style="vertical-align: inherit;"><font
                    style="vertical-align: inherit;">确认</font></font><i class="checkmark icon"></i></div>
        </div>
    </div>
</th:block>

<!------底部footer------>
<footer th:replace="_fragments :: footer">
    <!--底部teal颜色的条-->
    <div class="ui segment vertical teal inverted m-padded-tb-mini "></div>
    <!--底部footer正文-->
    <div class="ui inverted vertical segment m-padded-tb-big">
        <div class="ui container">
            <div class="ui stackable grid">
                <!--QQ微信联系方式二维码及打赏二维码占六个栅栏-->
                <div class="five wide center aligned column m-children-center">
                    <!--QQ联系方式二维码-->
                    <div class="m-inline-block m-margin-right-small">
                        <img src="../../static/images/Common/QQ.png" th:src="@{/images/Common/QQ.png}"
                             class="ui rounded image" alt=""
                             style="width: 100px;height: 100px">
                        <span class="m-margin-top-small m-opacity-mini">我的QQ</span>
                    </div>
                    <!--微信联系方式二维码-->
                    <div class="m-inline-block m-margin-right-small">
                        <img src="../../static/images/Common/WeChat.png" th:src="@{/images/Common/WeChat.png}"
                             class="ui rounded image" alt=""
                             style="width: 100px;height: 100px">
                        <span class="m-margin-top-small m-opacity-mini">我的微信</span>
                    </div>
                    <!--打赏方式二维码-->
                    <div class="m-inline-block">
                        <img src="../../static/images/Common/Pay.png" th:src="@{/images/Common/Pay.png}"
                             class="ui rounded image" alt=""
                             style="width: 100px;height: 100px">
                        <span class="m-margin-top-small m-opacity-mini" style="color: red">打赏</span>
                    </div>
                </div>
                <!--站点声明文字表述战11个栅栏-->
                <div class="eleven wide left aligned column ">
                    <h4 class="ui teal header">站点声明：</h4>
                    <p class="m-opacity-mini">1.文中的商标及图像版权属于其合法持有人，只供传递信息之用，非商务用途。交流时请遵守理性，宽容的原则。</p>
                    <p class="m-opacity-mini">2.所有文章未经授权禁止转载、摘编、复制或建立镜像，如有违反，追究法律责任。</p>
                    <p class="m-opacity-mini">Copyright © 2020 xinglongfei.cn. Designed by Phoenix.
                        备案号：京ICP备xxxxxxxx号-x </p>
                </div>
            </div>
        </div>
    </div>
</footer>

<!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<!--/*/</th:block>/*/-->

<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    $('.message .close')
        .on('click', function () {
            $(this)
                .closest('.message')
                .transition('fade');
        });

    function showDeleteDialog(thing,id,name) {
        $('.ui.mini.delete.modal')
            .modal('setting', 'closable', false)
            .modal({ //各种回调方法
                onShow: function () {
                    $('#delete-name')[0].innerHTML=name;
                },
                onApprove: function () {  //单击确认按钮
                    window.location = "/admin/"+thing+"/" + id + "/delete";
                },
            })
            .modal('show')
        ;
    }

</script>

</body>
</html>